package com.runen.infinitemovement.adapter;

import android.content.Context;
import android.view.View;
import android.widget.ImageView;
import android.widget.TextView;

import androidx.annotation.NonNull;

import com.chad.library.adapter.base.BaseQuickAdapter;
import com.chad.library.adapter.base.viewholder.BaseViewHolder;
import com.runen.infinitemovement.R;

public class CheckBranchAdapter extends BaseQuickAdapter<String, BaseViewHolder> {
    private Context context;
    private int checkPoint = -1;

    public CheckBranchAdapter(Context context) {
        super(R.layout.item_check_branch);
    }

    public void onCheckPoint(int checkPoint) {
        this.checkPoint = checkPoint;
    }

    @Override
    protected void convert(@NonNull BaseViewHolder helper, String item) {
        helper.setText(R.id.tv_branch_name, item);
        ImageView imageView = helper.getView(R.id.iv_check);
        if (checkPoint == helper.getAdapterPosition()) {
            imageView.setVisibility(View.VISIBLE);
        } else {
            imageView.setVisibility(View.GONE);
        }
    }
}
